package com.huangxt.test.xml;

import lombok.*;

import javax.xml.bind.annotation.*;
import java.io.Serializable;

@XmlAccessorType(XmlAccessType.FIELD)
// XML文件中的根标识
@XmlRootElement(name = "UserDTO")
// 控制JAXB 绑定类中属性和字段的排序
@XmlType(propOrder = {
        "userId",
        "userName",
        "userAge",
})
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class UserDTO implements Serializable {
    @XmlElement(name="user_id")
    private String userId;
    @XmlAttribute(name="user_name")
    private String userName;
    @XmlAttribute(name="user_age")
    private int userAge;
}
